package de.tabuma.lib.webservice.wsdl;

import java.lang.reflect.*;
import java.util.*;
import java.util.logging.*;

/**
 *
 * @author alefen
 */
public class WsdlFacade {

    private static final Logger log = Logger.getLogger(WsdlFacade.class.getName());

    public static String getWsdl(String url, String name, String namespace, Hashtable<String,Class> methodTable) {

        String str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
        str += "<definitions name=\""+name+"\" " +
                "targetNamespace=\""+namespace+"\" " +
                "xmlns=\"http://schemas.xmlsoap.org/wsdl/\" " +
                "xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" " +
                "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
                "xmlns:tns=\""+namespace+"\" " +
                "xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\">\n";

        str += TypeFacade.getType(namespace, methodTable);
        
        str += MessageFacade.getMessage(methodTable);

        str += PortTypeFacade.getPortType(methodTable);

        str += BindingFacade.getBinding(methodTable);

        str += ServiceFacade.getService(url, methodTable);

        str += "</definitions>\n";

        return str;
    }

    
}
